﻿using AutoMapper;
using HamcoWcs.Contract.ContractCommon;
using HamcoWcs.DAL;
using HamcoWcs.Models.Common.Enums;
using HamcoWcs.Service.Common;
using Quartz;
using System.Threading.Tasks;

namespace HamcoWcs.Workers
{
    /// <summary>
    /// 后台服务基类
    /// </summary>
    [AutoInject(typeof(IJob), InjectType.Worker)]
    public abstract class WorkerBase : IJob
    {
        protected readonly WcsDbContext _wcsDbContext;
        protected readonly IMapper _mapper;
        protected readonly ILoggerService _logger;

        protected WorkerBase(WcsDbContext wcsDbContext, IMapper mapper, ILoggerService logger)
        {
            _wcsDbContext = wcsDbContext;
            _mapper = mapper;
            _logger = logger;
        }

        public abstract Task Execute(IJobExecutionContext context);
    }
}
